package com.lh.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import com.lh.service.IExcelService;
import com.lh.utils.Answer;

@RestController
@RequestMapping("/excel")
public class ExcelController {

    @Autowired
    private IExcelService excelService;

    /**
     * 下载任务事项模板
     * @return
     */
    
    @GetMapping("/downloadTaskTemplateExcel")
    public ResponseEntity<byte[]> downloadTaskTemplateExcel() {
    	return excelService.downloadTaskTemplateExcel();
    }

    /**
     * 上传任务事项excel
     * @return
     */
    @PostMapping("/uploadTaskExcel")
    public Answer<String> uploadTaskExcel(@RequestParam("file") MultipartFile file) {
    	return excelService.uploadTaskExcel(file);
    }
}
